import {createApp} from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css'
//路由
import {router} from './router'
//状态管理
import {store} from './store'
//权限拦截处理
import "./config/permission";
//svgIcon
import svgIcon from '/src/components/SvgIcon/index.vue'
//Chrome51 版本以后，Chrome 增加了新的事件捕获机制－Passive Event Listeners
import 'default-passive-events'
//常用的工具
import {addDateRange, parseTime, resetForm, selectDictLabel} from './utils/DateUtile'
//查询数据字典
import {getDicts} from '/src/api/system/dict'
//按钮级别的权限控制
import hasPermi from '/src/components/directive/permission/hasPermi'
import {getPngSrc} from "./utils/baseTool";

const app = createApp(App)
app.use(ElementPlus)
app.use(router)
app.use(store)
app.component('svg-icon', svgIcon)
app.mount('#app')
app.directive('hasPermi', hasPermi)

//全局方法挂载
app.config.globalProperties.getDicts = getDicts
app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.parseTime = parseTime
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.selectDictLabel = selectDictLabel
//全局消息 成功 失败 info
app.config.globalProperties.msgSuccess = function (msg) {
    this.$message({showClose: true, message: msg, type: "success"});
}
app.config.globalProperties.msgError = function (msg) {
    this.$message({showClose: true, message: msg, type: "error"});
}
app.config.globalProperties.msgInfo = function (msg) {
    this.$message.info(msg);
}
//动态引入图片
app.config.globalProperties.getPngSrc = getPngSrc
